package com.electronicwallet;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;

/**
 * The Class AccountOverview displays to the user the overview of their account. It displays
 * their overall cash, budget, and cashflow.
 */
public class AccountOverview extends Activity implements OnClickListener{
	
	/**
	 * Called when the activity is first created. onCreate displays the layout mint which 
	 * shows the overview of the user's acocunts
	 *
	 * @param savedInstanceState the saved instance state
	 */
    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.mint);
        
        View backButton = findViewById(R.id.back);
        View accountView = findViewById(R.id.minttop);
        View budget = findViewById(R.id.mintmiddletop);
        View cashflow = findViewById(R.id.mintmiddlebottom);
        
        backButton.setOnClickListener(this);
        accountView.setOnClickListener(this);
        budget.setOnClickListener(this);
        cashflow.setOnClickListener(this);
    }

	/* Depending on the button click by the user, that button will execute.
	 * 
	 * @see android.view.View.OnClickListener#onClick(android.view.View)
	 */
	@Override
	public void onClick(View v) {
		Intent view;
		switch(v.getId()){
		// Back button, return to the previous screen
		case R.id.back:
			finish();
			break;
		// Show accounts, more detail of user's accounts
		case R.id.minttop:
			view = new Intent(this, AccountView.class);
			startActivity(view);
			break;
		// Budget, show the details of user's budget.
		case R.id.mintmiddletop:
			view = new Intent(this, AccountBudget.class);
			startActivity(view);
			break;
		// Cashflow, shows the users income and spending.
		case R.id.mintmiddlebottom:
			view = new Intent(this, AccountCashFlow.class);
			startActivity(view);
			break;
		}
	}
}
